package com.gxa.insurance.service.impl;

import com.gxa.insurance.exception.BusinessException;
import com.gxa.insurance.exception.ExceptionCode;
import com.gxa.insurance.mapper.AttachmentImageMapper;
import com.gxa.insurance.service.AttachmentImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author wang li sha
 * @date 2022-06-06 16:33
 */
@Service("attachmentImageService")
@Transactional(rollbackFor = Throwable.class)
public class AttachmentImageServiceImpl implements AttachmentImageService {
    @Autowired
    AttachmentImageMapper attachmentImageMapper;


    @Override
    public Integer insertOrderImageByNumber(String number, String imagPath) throws Exception {
        Integer insert = attachmentImageMapper.insertOrderImageByNumber(number, imagPath);
        if (insert != 1) {
            throw new BusinessException(ExceptionCode.INSERT_ORDERATTACHMENTIMAGE_FAILED);
        }
        return insert;
    }
}
